<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="div">
        <input type="checkbox" name="a" id="" value="banana">banana
        <input type="checkbox" name="a" id="" value="apple">apple
        <input type="checkbox" name="a" id="" value="orange">orange
        <p></p>
    </div>
    <script>
    var input = document.getElementsByTagName('input');
    var len = input.length;
    var p = document.querySelector('p');
    div.onchange = function () {
        for (var i = 0; i < len; i++) {
            if (input[i].checked == true) {
                p.innerText = '您选择的是'+input[i].value;
            }
        }
    }

    </script>
</body>
</html>